package com.wyix.entity;

/**
 * @author wangdx
 * @since 2025/8/1
 */
public class Teacher extends Person {
    // 子类特有属性
    private String teacherId; // 教师工号
    private String course;    // 授课课程

    // 子类构造器：调用父类构造器
    public Teacher(String name, int age, String gender, String teacherId, String course) {
        super(name, age, gender); // 初始化父类属性
        this.teacherId = teacherId;
        this.course = course;
    }

    // 子类特有方法：授课
    public void teach() {
        System.out.println(getName() + "老师正在讲授《" + course + "》");
    }

    // 重写父类方法：添加教师特有信息
    @Override
    public void introduce() {
        super.introduce(); // 复用父类逻辑
        System.out.println("我是" + course + "教师，工号：" + teacherId);
    }
}
